package com.example.demo.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class RestBean<T> {
    private boolean success;
    private int state;
    private T data;

    public static <T> RestBean success(int state, T data) {
        return new RestBean(true, state, data);
    }

    public static <T> RestBean success(T data) {
        return new RestBean(true, 200, data);
    }

    public static <T> RestBean failure(int state, T data) {
        return new RestBean(false, state, data);
    }

    public static <T> RestBean failure(T data) {
        return new RestBean(true, 500, data);
    }

}
